//#Author:bin
// -*- charset = utf-8 -*-
// @time:2021/12/20 11:56
// @Author:bfl91
// @file : detail.js
// @Software:WebStorm
export default{
    namespaced:true,
    state:{
        Collection:[],//收藏的商品
    },
    getters:{
        getCollection(state){
            let number=state.Collection.length
            let list=state.Collection;
            return {
                number,
                list
            }
        }
    },
    mutations:{
        reovemShop(state,index){
            state.Collection.splice(index,1);
        },
        setCollection(state,obj){//添加收藏
            state.Collection.push(obj);
        },
        getCollection(state,obj){//取消收藏
            for(var i in state.Collection){
                if(state.Collection[i].goods_id==obj.goods_id){
                    state.Collection[i]=obj;
                }
            }
        }
    },
}